package org.springcloud.wisdom.springcloud_03_freshman.admin.controller;

import org.springcloud.wisdom.springcloud_03_freshman.admin.service.AdminDeptService;
import org.springcloud.wisdom.springcloud_03_freshman.common.bean.ResponseData;
import org.springcloud.wisdom.springcloud_03_freshman.common.controller.BaseController;
import org.springcloud.wisdom.springcloud_03_freshman.student.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/dept")
public class AdminDeptController extends BaseController {
    @Autowired
    AdminDeptService adminDeptService;
    //增加
    @PostMapping("/insert")
    public ResponseData<Boolean> insert(Dept dept) {
        return returnBoolean(adminDeptService.insertDept(dept));
    }
    //删除
    @DeleteMapping("/delete/{deptid}")
public  ResponseData<Boolean> delete(@PathVariable("deptid") Integer deptid){
        return returnBoolean(adminDeptService.deleteDept(deptid));
    }
    //修改
    @PutMapping("/update")
    public ResponseData<Boolean> update(@RequestBody Dept dept){
        return returnBoolean(adminDeptService.updateDept(dept));
    }
}
